﻿
Partial Class adminpanel_User
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        If Not Me.IsPostBack Then
            fillUsers()
        End If
    End Sub
    Private Sub fillUsers()
        GwUser.DataSource = Pic.Users.GetUsersListByFilter()
        GwUser.DataBind()
    End Sub

    'Protected Sub GwUser_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GwUser.RowEditing
    '    GwUser.EditIndex = e.NewEditIndex
    '    fillUsers()
    'End Sub

    'Protected Sub GwUser_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GwUser.RowUpdating
    '    Pic.Users.UpdateUser(CType(GwUser.Rows(e.RowIndex).FindControl)
    'End Sub

    Protected Sub GwUser_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GwUser.RowCommand
        If e.CommandName = "UserDelete" Then
            Pic.Users.DeleteUser(e.CommandArgument)
            fillUsers()
        End If
        If e.CommandName = "UserEdit" Then
            Dim qs As New Pic.SecureQueryString
            qs("Email") = e.CommandArgument
            Response.Redirect("UserAdd.aspx?id=" & qs.ToString)
        End If
    End Sub
End Class
